d <- read_sav(here("data", "d4 - scales & covariates.sav"))
Model assumptions & diagnostics
d$engage
## [1] 4.500 4.250 4.375 3.875 4.875 3.875 3.625 4.000 4.750 4.375 3.250 4.375
## [13] 3.875 3.625 3.500 3.875 3.875 3.625 3.750 3.750 4.375 4.500 4.500 3.875
## [25] 4.875 4.250 4.875 3.875 4.625 4.625 4.000 3.250 5.000 4.000 4.000 4.125
## [37] 4.125 4.500 4.000 4.500 3.500 5.000 3.625 3.875 3.875 4.250 3.625 4.750
## [49] 4.750 3.000 4.625 4.250 3.625 4.750 5.000 3.750 4.750 4.250 4.000 4.750
## [61] 4.250 3.375 4.875 3.750 4.500 4.625 4.000 3.875 3.625 4.750 4.250 4.625
## [73] 3.125 4.625 3.000 4.375 4.000 4.375 3.500 3.000 2.250 4.500 4.000 3.750
## [85] 4.500 4.750 3.375 4.125 4.500 3.750 4.000 3.250 3.500 4.500
## attr(,"format.spss")
## [1] "F8.2"
ggplot(d, aes(engage)) +
geom_histogram(alpha = 0.7) # meets normality assumption? assumption may be tenable, maybe presence of an outlier (score 2.250) participant row 81
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
d_no81 <- d %>%
filter(participant_id != "608_1") # 93 rows now
ggplot(d_no81, aes(engage)) +
geom_histogram(alpha = 0.7)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
ggplot(d, aes(hwi_1, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
ggplot(d_no81, aes(hwi_1, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Removed 1 rows containing missing values (geom_point).
# plots - univariate
m_hwi_1a <- lm(engage ~ hwi_1, d)
plot(m_hwi_1a)
m_hwi_1a_d_no81 <- lm(engage ~ hwi_1, d_no81)
plot(m_hwi_1a_d_no81)
coef(m_hwi_1a)
## (Intercept) hwi_1
## 3.6873295 0.1519164
coef(m_hwi_1a_d_no81)
## (Intercept) hwi_1
## 3.89924713 0.08042387
plot(m_hwi_1a, which = 4)
plot(m_hwi_1a_d_no81, which = 4)
ggplot(d, aes(hwi_2, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
ggplot(d_no81, aes(hwi_2, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Removed 1 rows containing missing values (geom_point).
# plots
m_hwi_2a <- lm(engage ~ hwi_2, d)
plot(m_hwi_2a)
m_hwi_2a_d_no81 <- lm(engage ~ hwi_2, d_no81)
plot(m_hwi_2a_d_no81)
coef(m_hwi_2a)
## (Intercept) hwi_2
## 3.3847767 0.2188261
coef(m_hwi_2a_d_no81)
## (Intercept) hwi_2
## 3.6388939 0.1461771
plot(m_hwi_2a, which = 4)
plot(m_hwi_2a_d_no81, which = 4)
ggplot(d, aes(hwi_3, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
# plots
m_hwi_3a <- lm(engage ~ hwi_3, d)
plot(m_hwi_3a)
m_hwi_3a_d_no81 <- lm(engage ~ hwi_3, d_no81)
plot(m_hwi_3a_d_no81)
coef(m_hwi_3a)
## (Intercept) hwi_3
## 3.6791139 0.1524149
coef(m_hwi_3a_d_no81)
## (Intercept) hwi_3
## 3.8346718 0.1024288
plot(m_hwi_3a, which = 4)
plot(m_hwi_3a_d_no81, which = 4)
ggplot(d, aes(monit, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
m_monit_a <- lm(engage ~ monit, d)
plot(m_monit_a)
m_monit_a_no81 <- lm(engage ~ monit, d_no81)
plot(m_monit_a_no81)
coef(m_monit_a)
## (Intercept) monit
## 4.03395459 0.02047014
coef(m_monit_a_no81)
## (Intercept) monit
## 4.452410 -0.108462
plot(m_monit_a, which = 4)
plot(m_monit_a_no81, which = 4)
5. structure at home
ggplot(d, aes(str_home, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
# plots
m_str_home_a <- lm(engage ~ str_home, d)
plot(m_str_home_a)
m_str_home_a_no81 <- lm(engage ~ str_home, d_no81)
plot(m_str_home_a_no81)
coef(m_str_home_a)
## (Intercept) str_home
## 3.3138044 0.2662147
coef(m_str_home_a_no81)
## (Intercept) str_home
## 3.7137830 0.1363654
plot(m_str_home_a, which = 4)
plot(m_str_home_a_no81, which = 4)
6. convos: child beh & school climate
ggplot(d, aes(convos_1, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
m_convos_1a <- lm(engage ~ convos_1, d)
plot(m_convos_1a)
m_convos_1a_no81 <- lm(engage ~ convos_1, d_no81)
plot(m_convos_1a_no81)
coef(m_convos_1a)
## (Intercept) convos_1
## 4.15626415 -0.01673332
coef(m_convos_1a_no81)
## (Intercept) convos_1
## 4.18311182 -0.01870638
plot(m_convos_1a, which = 4)
plot(m_convos_1a_no81, which = 4)
7. convos: future career planning
ggplot(d, aes(convos_2, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
# plots
m_convos_2a <- lm(engage ~ convos_2, d)
plot(m_convos_2a)
m_convos_2a_no81 <- lm(engage ~ convos_2, d_no81)
plot(m_convos_2a_no81)
coef(m_convos_2a)
## (Intercept) convos_2
## 3.6189155 0.1489131
coef(m_convos_2a_no81)
## (Intercept) convos_2
## 3.5987248 0.1615428
plot(m_convos_2a, which = 4)
plot(m_convos_2a_no81, which = 4)
ggplot(d, aes(convos_3, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
m_convos_3a <- lm(engage ~ convos_3, d)
plot(m_convos_3a)
m_convos_3a_no81 <- lm(engage ~ convos_3, d_no81)
plot(m_convos_3a_no81)
coef(m_convos_3a)
## (Intercept) convos_3
## 3.7249928 0.1074522
coef(m_convos_3a_no81)
## (Intercept) convos_3
## 3.78682533 0.09526841
plot(m_convos_3a, which = 4)
plot(m_convos_3a_no81, which = 4)
9. Basic involvement # linearity
ggplot(d, aes(sbi_1, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
m_sbi_1a <- lm(engage ~ sbi_1, d)
plot(m_sbi_1a)
m_sbi_1a_no81 <- lm(engage ~ sbi_1, d_no81)
plot(m_sbi_1a_no81)
coef(m_sbi_1a)
## (Intercept) sbi_1
## 3.4600308 0.2160509
coef(m_sbi_1a_no81)
## (Intercept) sbi_1
## 3.6681932 0.1516645
plot(m_sbi_1a, which = 4)
plot(m_sbi_1a_no81, which = 4)
10. Resource-intensive involvement # linearity
ggplot(d, aes(sbi_2, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
m_sbi_2a <- lm(engage ~ sbi_2, d)
plot(m_sbi_2a)
m_sbi_2a_no81 <- lm(engage ~ sbi_2, d_no81)
plot(m_sbi_2a_no81)
coef(m_sbi_2a)
## (Intercept) sbi_2
## 3.4730366 0.2364352
coef(m_sbi_2a_no81)
## (Intercept) sbi_2
## 3.7845217 0.1251092
plot(m_sbi_2a, which = 4)
plot(m_sbi_2a_no81, which = 4)
11. Belongingness # linearity
ggplot(d, aes(belong, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
# plots
m_belong_a <- lm(engage ~ belong, d)
plot(m_belong_a)
m_belong_a_no81 <- lm(engage ~ belong, d_no81)
plot(m_belong_a_no81)
coef(m_belong_a)
## (Intercept) belong
## 4.079666022 0.005713666
coef(m_belong_a_no81)
## (Intercept) belong
## 4.21013216 -0.03056167
plot(m_belong_a, which = 4)
plot(m_belong_a_no81, which = 4)
ggplot(d, aes(endorse, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 3
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.33333
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at 3
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 0.33333
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 0
## `geom_smooth()` using formula 'y ~ x'
# plots
m_endorse_a <- lm(engage ~ endorse, d)
plot(m_endorse_a)
m_endorse_a_no81 <- lm(engage ~ endorse, d_no81)
plot(m_endorse_a_no81)
coef(m_endorse_a)
## (Intercept) endorse
## 4.37416770 -0.08779808
coef(m_endorse_a_no81)
## (Intercept) endorse
## 4.4549694 -0.1070505
plot(m_endorse_a, which = 4)
plot(m_endorse_a_no81, which = 4)
ggplot(d, aes(value_ed, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
m_value_ed_a <- lm(engage ~ value_ed, d)
plot(m_value_ed_a)
m_value_ed_a_no81 <- lm(engage ~ value_ed, d_no81)
plot(m_value_ed_a_no81)
coef(m_value_ed_a)
## (Intercept) value_ed
## 3.96306916 0.03809425
coef(m_value_ed_a_no81)
## (Intercept) value_ed
## 3.7935313 0.0920712
plot(m_value_ed_a, which = 4)
plot(m_value_ed_a_no81, which = 4)
ggplot(d, aes(rel_1, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
# plots
m_rel_1a <- lm(engage ~ rel_1, d)
plot(m_rel_1a)
m_rel_1a_no81 <- lm(engage ~ rel_1, d_no81)
plot(m_rel_1a_no81)
coef(m_rel_1a)
## (Intercept) rel_1
## 4.683435 -0.187491
coef(m_rel_1a_no81)
## (Intercept) rel_1
## 4.40937847 -0.09375073
plot(m_rel_1a, which = 4)
plot(m_rel_1a_no81, which = 4)
ggplot(d, aes(rel_2, engage)) +
geom_point() +
geom_smooth() +
geom_smooth(method = "lm",
color = "magenta")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 3
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.25
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at 3
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius 0.25
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 0
## `geom_smooth()` using formula 'y ~ x'
m_rel_2a <- lm(engage ~ rel_2, d)
plot(m_rel_2a)
m_rel_2a_no81 <- lm(engage ~ rel_2, d_no81)
plot(m_rel_2a_no81)
coef(m_rel_2a)
## (Intercept) rel_2
## 3.90116608 0.06351959
coef(m_rel_2a_no81)
## (Intercept) rel_2
## 4.25640514 -0.04508926
plot(m_rel_2a, which = 4)
plot(m_rel_2a_no81, which = 4)
d$q54_p1
## [1] 3 3 3 3 3 3 4 2 3 3 3 3 3 3 4 4 3 4 3 4 3 3 3 3 3 3 3 4 3 3 3 4 3 4 3 3 3 3
## [39] 3 3 3 4 4 3 3 4 3 3 4 3 3 4 3 3 3 3 4 4 4 3 3 3 4 3 3 3 3 3 3 3 3 2 3 4 4 3
## [77] 3 4 4 3 1 3 3 3 2 3 3 3 3 3 3 3 2 3
## attr(,"format.spss")
## [1] "F8.2"
d_no81$q54_p1
## [1] 3 3 3 3 3 3 4 2 3 3 3 3 3 3 4 4 3 4 3 4 3 3 3 3 3 3 3 4 3 3 3 4 3 4 3 3 3 3
## [39] 3 3 3 4 4 3 3 4 3 3 4 3 3 4 3 3 3 3 4 4 4 3 3 3 4 3 3 3 3 3 3 3 3 2 3 4 4 3
## [77] 3 4 4 3 3 3 3 2 3 3 3 3 3 3 3 2 3
## attr(,"format.spss")
## [1] "F8.2"